from sqlmodel import select, Session

from app.core.database import engine
from app.models.rbac import User

def get_by_login_name(login_name: str) -> User:
    with Session(engine) as session:
        statement = select(User).where(User.login_name == login_name)
        result = session.exec(statement).first()
    return result
